package com.zwz.resp.maininfo;

import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;
import java.util.*;

@Data
public class JudicialCaseResponse {
    private Integer stat;
    private Integer total;
    private List<CaseInfo> data;
    private CaseConfig configs;

    @Data
    public static class CaseInfo {
        @JsonProperty("caseType")
        private String type;

        @JsonProperty("caseNumber")
        private String caseNo;

        private String courtName;
        private String caseStatus;
        private String caseReason;

        @JsonProperty("cleanCaseNumber")
        private String formattedCaseNo;

        private String source;

        @JsonFormat(pattern = "yyyy-MM-dd")
        private Date caseCreateTime;

        private String caseYear;
        private String _id;

        @JsonProperty("litigantList")
        private List<Litigant> parties;

        // 清洗异常字符的案号
        @JsonIgnore
        public String getCleanCaseNumber() {
            return caseNo.replaceAll("[^\\u4e00-\\u9fa5a-zA-Z0-9()��-]", "");
        }
    }

    @Data
    public static class Litigant {
        @JsonProperty("nameId")
        private String partyId;
        private String type;
        private String name;
    }

    @Data
    public static class CaseConfig {
        @JsonProperty("caseTypeList")
        private List<String> caseTypes = new ArrayList<>();

        @JsonProperty("caseIdentityList")
        private List<String> identities = new ArrayList<>();

        @JsonProperty("caseYears")
        private List<String> years = new ArrayList<>();
    }

    public Integer getStat() {
        return this.stat;
    }

    public void setStat(Integer stat) {
        this.stat = stat;
    }

    public Integer getTotal() {
        return this.total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public List<CaseInfo> getData() {
        return this.data;
    }

    public void setData(List<CaseInfo> data) {
        this.data = data;
    }

    public CaseConfig getConfigs() {
        return this.configs;
    }

    public void setConfigs(CaseConfig configs) {
        this.configs = configs;
    }

}